package com.haibei.net;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.common.net.NetResult;
import com.common.uitl.LogUtil;
import com.common.uitl.StringUtils;
import com.haibei.App;
import com.haibei.adapter.bean.Article;
import com.haibei.adapter.bean.ArticleCategory;
import com.haibei.adapter.bean.ArticleRegion;
import com.haibei.adapter.bean.BrandRegion;
import com.haibei.adapter.bean.CollectArticle;
import com.haibei.adapter.bean.CollectGoods;
import com.haibei.adapter.bean.CollectTopic;
import com.haibei.adapter.bean.Comment;
import com.haibei.adapter.bean.Goods;
import com.haibei.adapter.bean.GoodsType;
import com.haibei.adapter.bean.HotGoodsBanner;
import com.haibei.adapter.bean.Message;
import com.haibei.adapter.bean.Topic;
import com.haibei.adapter.bean.TopicOption;
import com.haibei.adapter.bean.TopicSelected;
import com.haibei.adapter.bean.User;

public class JsonParser {

	public static final String data = "data";
	public static final String body = "body";
	public static final String message = "message";
	public static final String success = "success";

	// 批量删除公共解析接口
	public static NetResult parseBatchRemove(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	// 商城首页分类
	public static NetResult parselistParCategory(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONArray bodyary = jso.getJSONArray(body);
			ArrayList<GoodsType> godsType = new ArrayList<GoodsType>();

			GoodsType gtype = null;

			for (int i = 0, ilen = bodyary.length(); i < ilen; i++) {
				JSONObject jsoBject = bodyary.getJSONObject(i);
				gtype = new GoodsType(false);

				String iconDefault = getStringFroJso("iconDefault", jsoBject);
				gtype.setIconDefaultUrl(NetInterface.warpImgUrl(iconDefault));

				String iconSelected = getStringFroJso("iconSelected", jsoBject);
				gtype.setIconSelectUrl(NetInterface.warpImgUrl(iconSelected));

				String id = getStringFroJso("id", jsoBject);
				gtype.setId(id);

				String name = getStringFroJso("name", jsoBject);
				gtype.setName(name);

				String parentId = getStringFroJso("parentId", jsoBject);
				gtype.setParentId(parentId);

				String sequence = getStringFroJso("sequence", jsoBject);
				gtype.setSequence(sequence);
				godsType.add(gtype);
			}
			Object[] data = { godsType };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	// 商城首页分类
	public static NetResult parseBanner(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONArray bodyary = jso.getJSONArray(body);
			ArrayList<HotGoodsBanner> hots = new ArrayList<HotGoodsBanner>();
			for (int i = 0, ilen = bodyary.length(); i < ilen; i++) {
				JSONObject jobj = bodyary.getJSONObject(i);
				HotGoodsBanner hotgods = new HotGoodsBanner();
				hotgods.setBannerImg(NetInterface.warpImgUrl(getStringFroJso("bannerImg", jobj)));
				hotgods.setId(getStringFroJso("id", jobj));
				hotgods.setRemark(getStringFroJso("remark", jobj));
				hotgods.setSequence(getStringFroJso("sequence", jobj));
				hotgods.setWareIds(getStringFroJso("wareIds", jobj));
				hots.add(hotgods);
			}
			Object[] data = { hots };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	// 修改密码
	public static NetResult parseChangePassWord(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	public static NetResult parseBrand(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONArray jsary = jso.getJSONArray(body);

			ArrayList<BrandRegion> brandlist = new ArrayList<BrandRegion>();
			for (int i = 0, isize = jsary.length(); i < isize; i++) {
				JSONObject jobj = jsary.getJSONObject(i);
				BrandRegion brd = new BrandRegion(true);
				brd.setId(getStringFroJso("id", jobj));
				brd.setName(getStringFroJso("name", jobj));
				brd.setSequence(getStringFroJso("sequence", jobj));
				brandlist.add(brd);
			}
			Object[] data = { brandlist };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	// 解析商品列表
	public static NetResult parseGoodsList(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONArray jsary = jso.getJSONArray(body);
			ArrayList<Goods> goodsList = new ArrayList<Goods>();
			for (int i = 0, isize = jsary.length(); i < isize; i++) {
				JSONObject jobj = jsary.getJSONObject(i);
				Goods gods = new Goods();
				gods.setAfterScale(getStringFroJso("afterSale", jobj));

				JSONObject jbrand = jobj.getJSONObject("brand");
				BrandRegion brand = new BrandRegion(true);
				brand.setId(getStringFroJso("id", jbrand));
				brand.setName(getStringFroJso("name", jbrand));
				brand.setSequence(getStringFroJso("sequence", jbrand));
				gods.setBrand(brand);
				// =====
				gods.setBrandId(getStringFroJso("brandId", jobj));

				JSONObject jtypeJson = jobj.getJSONObject("parCategory");
				GoodsType godType = new GoodsType(false);
				godType.setIconDefaultUrl(NetInterface.warpImgUrl(getStringFroJso("iconDefault", jtypeJson)));
				godType.setIconSelectUrl(NetInterface.warpImgUrl(getStringFroJso("iconSelected", jtypeJson)));
				godType.setId(getStringFroJso("id", jtypeJson));
				godType.setName(getStringFroJso("name", jtypeJson));
				godType.setParentId(getStringFroJso("parentId", jtypeJson));
				godType.setSequence(getStringFroJso("sequence", jtypeJson));
				gods.setType(godType);// 商品类型
				// ====
				gods.setCostPrice(getStringFroJso("costPrice", jobj));
				gods.setSalePrice(getStringFroJso("salePrice", jobj));
				gods.setMarketPrice(getStringFroJso("marketPrice", jobj));
				gods.setSales(getStringFroJso("sales", jobj));
				gods.setDetailIntro(getStringFroJso("detailIntro", jobj));
				gods.setFavoriteCount(getStringFroJso("favoriteCount", jobj));
				gods.setId(getStringFroJso("id", jobj));
				gods.setPromotion(jobj.getBoolean("promotion"));
				// ====
				BrandRegion bregion = new BrandRegion(false);
				JSONObject regonObj = jobj.getJSONObject("region");
				bregion.setId(getStringFroJso("id", regonObj));
				bregion.setName(getStringFroJso("name", regonObj));
				bregion.setSequence(getStringFroJso("sequence", regonObj));
				gods.setRegion(bregion);
				gods.setRegionId(getStringFroJso("regionId", jobj));
				// =======
				gods.setSlogan(getStringFroJso("slogan", jobj));
				gods.setSpecification(getStringFroJso("specification", jobj));
				gods.setStatus(getStringFroJso("status", jobj));
				// =====
				JSONObject subTypeJson = jobj.getJSONObject("subCategory");
				GoodsType subType = new GoodsType(false);
				subType.setIconDefaultUrl(NetInterface.warpImgUrl(getStringFroJso("iconDefault", subTypeJson)));
				subType.setIconSelectUrl(NetInterface.warpImgUrl(getStringFroJso("iconSelected", subTypeJson)));
				subType.setId(getStringFroJso("id", subTypeJson));
				subType.setName(getStringFroJso("name", subTypeJson));
				subType.setParentId(getStringFroJso("parentId", subTypeJson));
				subType.setSequence(getStringFroJso("sequence", subTypeJson));
				gods.setSubType(subType);
				// ======
				gods.setSubTitle(getStringFroJso("subTitle", jobj));
				gods.setThumbnailImg(NetInterface.warpImgUrl(getStringFroJso("thumbnailImg", jobj)));
				gods.setTitle(getStringFroJso("title", jobj));
				gods.setUnit(getStringFroJso("unit", jobj));
				gods.setUpTime(getStringFroJso("upTime", jobj));
				goodsList.add(gods);
			}
			Object[] data = { goodsList };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	// 解析货物详情
	public static NetResult parseGoodsDetail(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			Goods gods = new Goods();
			{
				JSONObject jobj = jso.getJSONObject(body);
				gods.setAfterScale(getStringFroJso("afterSale", jobj));
				JSONObject jbrand = jobj.getJSONObject("brand");
				BrandRegion brand = new BrandRegion(true);
				brand.setId(getStringFroJso("id", jbrand));
				brand.setName(getStringFroJso("name", jbrand));
				brand.setSequence(getStringFroJso("sequence", jbrand));
				gods.setBrand(brand);
				// =====
				gods.setBrandId(getStringFroJso("brandId", jobj));

				JSONObject jtypeJson = jobj.getJSONObject("parCategory");
				GoodsType godType = new GoodsType(false);
				godType.setIconDefaultUrl(NetInterface.warpImgUrl(getStringFroJso("iconDefault", jtypeJson)));
				godType.setIconSelectUrl(NetInterface.warpImgUrl(getStringFroJso("iconSelected", jtypeJson)));
				godType.setId(getStringFroJso("id", jtypeJson));
				godType.setName(getStringFroJso("name", jtypeJson));
				godType.setParentId(getStringFroJso("parentId", jtypeJson));
				godType.setSequence(getStringFroJso("sequence", jtypeJson));
				gods.setType(godType);// 商品类型
				// ====
				gods.setCostPrice(getStringFroJso("costPrice", jobj));
				gods.setSalePrice(getStringFroJso("salePrice", jobj));
				gods.setMarketPrice(getStringFroJso("marketPrice", jobj));
				gods.setSales(getStringFroJso("sales", jobj));
				gods.setDetailIntro(getStringFroJso("detailIntro", jobj));
				gods.setFavoriteCount(getStringFroJso("favoriteCount", jobj));
				gods.setId(getStringFroJso("id", jobj));
				gods.setPromotion(jobj.getBoolean("promotion"));
				// ====
				BrandRegion bregion = new BrandRegion(false);
				JSONObject regonObj = jobj.getJSONObject("region");
				bregion.setId(getStringFroJso("id", regonObj));
				bregion.setName(getStringFroJso("name", regonObj));
				bregion.setSequence(getStringFroJso("sequence", regonObj));
				gods.setRegion(bregion);
				gods.setRegionId(getStringFroJso("regionId", jobj));
				// =======
				gods.setSlogan(getStringFroJso("slogan", jobj));
				gods.setSpecification(getStringFroJso("specification", jobj));
				gods.setStatus(getStringFroJso("status", jobj));
				// =====
				JSONObject subTypeJson = jobj.getJSONObject("subCategory");
				GoodsType subType = new GoodsType(false);
				subType.setIconDefaultUrl(NetInterface.warpImgUrl(getStringFroJso("iconDefault", subTypeJson)));
				subType.setIconSelectUrl(NetInterface.warpImgUrl(getStringFroJso("iconSelected", subTypeJson)));
				subType.setId(getStringFroJso("id", subTypeJson));
				subType.setName(getStringFroJso("name", subTypeJson));
				subType.setParentId(getStringFroJso("parentId", subTypeJson));
				subType.setSequence(getStringFroJso("sequence", subTypeJson));
				gods.setSubType(subType);
				// ======
				gods.setSubTitle(getStringFroJso("subTitle", jobj));
				gods.setThumbnailImg(NetInterface.warpImgUrl(getStringFroJso("thumbnailImg", jobj)));
				gods.setTitle(getStringFroJso("title", jobj));
				gods.setUnit(getStringFroJso("unit", jobj));
				gods.setUpTime(getStringFroJso("upTime", jobj));
			}

			JSONObject jDataObj = jso.getJSONObject("data");
			String coment = jDataObj.getString("commentCount");
			Object[] data = { gods, coment };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	// 解析区域
	public static NetResult parseRegion(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONArray jsary = jso.getJSONArray(body);

			ArrayList<BrandRegion> brandlist = new ArrayList<BrandRegion>();
			for (int i = 0, isize = jsary.length(); i < isize; i++) {
				JSONObject jobj = jsary.getJSONObject(i);
				BrandRegion brd = new BrandRegion(false);
				brd.setId(getStringFroJso("id", jobj));
				brd.setName(getStringFroJso("name", jobj));
				brd.setSequence(getStringFroJso("sequence", jobj));
				brandlist.add(brd);
			}
			Object[] data = { brandlist };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 解析版本更新
	 * 
	 * @param jsonString
	 * @return
	 * @throws JSONException
	 */
	public static NetResult parseRegist(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		// {"data":{},"message":"用户名不存在","success":false}

		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONObject jsoEntity = jso.getJSONObject(body);
			//
			String id = getStringFroJso("id", jsoEntity);
			String nikename = getStringFroJso("nikename", jsoEntity);
			String password = getStringFroJso("password", jsoEntity);
			String sex = getStringFroJso("sex", jsoEntity);
			String sexDesc = getStringFroJso("sexDesc", jsoEntity);
			String type = getStringFroJso("type", jsoEntity);
			String username = getStringFroJso("username", jsoEntity);

			User u = new User();
			u.setUid(id);
			u.setNikename(nikename);
			u.setPassword(password);
			u.setSex((sex));
			u.setType((type));
			u.setUsername(username);
			Object[] data = { u };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	public static NetResult parseLogin(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		// {"data":{},"message":"用户名不存在","success":false}

		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONObject jsoEntity = jso.getJSONObject(body);

			//
			String id = getStringFroJso("id", jsoEntity);
			String nikename = getStringFroJso("nikename", jsoEntity);
			String password = getStringFroJso("password", jsoEntity);
			String sex = getStringFroJso("sex", jsoEntity);
			String type = getStringFroJso("type", jsoEntity);
			String username = getStringFroJso("username", jsoEntity);
			String stage = getStringFroJso("stage", jsoEntity);

			User u = new User();
			u.setUid(id);
			u.setStage(stage);
			u.setNikename(nikename);
			u.setPassword(password);
			u.setSex((sex));
			u.setType((type));
			u.setUsername(username);
			Object[] data = { u };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 解析文章类型
	 * 
	 * @param jsonString
	 * @throws JSONException
	 */
	public static NetResult parseArticleCategory(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			ArrayList<ArticleCategory> categories = new ArrayList<ArticleCategory>();
			JSONArray ary = jso.getJSONArray(body);
			for (int i = 0; i < ary.length(); i++) {
				JSONObject jobj = ary.getJSONObject(i);
				ArticleCategory artCategory = new ArticleCategory(false);
				// "iconDefault":"4c99da68-0531-407f-8c98-c07e6a77e657.jpg",
				String iconDefault = getStringFroJso("iconDefault", jobj);
				artCategory.setIconDefault(iconDefault);
				// "iconSelected":"662faccd-b55a-4bbd-b497-028382582717.jpg",
				String iconSelected = getStringFroJso("iconSelected", jobj);
				artCategory.setIconSelected(iconSelected);
				// "id":10,
				String id = getStringFroJso("id", jobj);
				artCategory.setId(id);
				// "name":"营养健康",
				String name = getStringFroJso("name", jobj);
				artCategory.setName(name);
				// "sequence":4,
				String sequence = getStringFroJso("sequence", jobj);
				artCategory.setSequence(Integer.parseInt(sequence));
				categories.add(artCategory);
			}
			Object[] data = { categories };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 解析文章列表
	 * 
	 * @param jsonString
	 * @throws JSONException
	 */
	public static NetResult parseArticles(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONArray ary = jso.getJSONArray(body);
			ArrayList<Article> articles = new ArrayList<Article>();
			for (int i = 0; i < ary.length(); i++) {
				JSONObject jobj = ary.getJSONObject(i);
				Article article = new Article();
				article.setAuthor(jobj.getString("author"));
				article.setCategoryId(jobj.getString("categoryId"));
				article.setContent(jobj.getString("content"));
				article.setCoverImg(jobj.getString("coverImg"));
				article.setId(jobj.getString("id"));
				article.setIsOrigin(jobj.getString("isOriginal"));
				article.setOrigin(jobj.getString("origin"));
				article.setOriginalLink(jobj.getString("originalLink"));
				article.setPublishTime(jobj.getString("publishTime"));
				article.setRegionId(jobj.getString("regionId"));
				article.setTitle(jobj.getString("title"));

				JSONObject jcategory = jobj.getJSONObject("category");
				ArticleCategory aca = new ArticleCategory(false);
				aca.setId(jcategory.getString("id"));
				aca.setIconDefault(jcategory.getString("iconDefault"));
				aca.setIconSelected(jcategory.getString("iconSelected"));
				aca.setName(jcategory.getString("name"));
				aca.setSequence(Integer.parseInt(jcategory.getString("sequence")));
				article.setCategory(aca);// 类别

				JSONObject jregion = jobj.getJSONObject("region");

				ArticleRegion ar = new ArticleRegion();
				ar.setId(jregion.getString("id"));
				ar.setName(jregion.getString("name"));

				article.setRegion(ar);

				articles.add(article);
			}

			Object[] data = { articles };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 解析收藏的文章列表
	 * 
	 * @param jsonString
	 * @throws JSONException
	 */
	public static NetResult parseCollectArticles(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONArray ary = jso.getJSONArray(body);
			ArrayList<CollectArticle> articles = new ArrayList<CollectArticle>();
			for (int i = 0; i < ary.length(); i++) {
				JSONObject jobj = ary.getJSONObject(i);

				CollectArticle article = new CollectArticle();
				article.setSelfId(getStringFroJso("id", jobj));
				article.setType(getStringFroJso("type", jobj));
				article.setUid(getStringFroJso("uid", jobj));

				JSONObject jsArticle = jobj.getJSONObject("article");

				// =====
				article.setAuthor(jsArticle.getString("author"));
				article.setCategoryId(jsArticle.getString("categoryId"));
				article.setContent(jsArticle.getString("content"));
				article.setCoverImg(jsArticle.getString("coverImg"));
				article.setId(jsArticle.getString("id"));
				article.setIsOrigin(jsArticle.getString("isOriginal"));
				article.setOrigin(jsArticle.getString("origin"));
				article.setOriginalLink(jsArticle.getString("originalLink"));
				article.setPublishTime(jsArticle.getString("publishTime"));
				article.setRegionId(jsArticle.getString("regionId"));
				article.setTitle(jsArticle.getString("title"));

				JSONObject jcategory = jsArticle.getJSONObject("category");

				ArticleCategory aca = new ArticleCategory(false);
				aca.setId(jcategory.getString("id"));
				aca.setIconDefault(jcategory.getString("iconDefault"));
				aca.setIconSelected(jcategory.getString("iconSelected"));
				aca.setName(jcategory.getString("name"));
				aca.setSequence(Integer.parseInt(jcategory.getString("sequence")));
				article.setCategory(aca);// 类别

				JSONObject jregion = jsArticle.getJSONObject("region");
				ArticleRegion ar = new ArticleRegion();
				ar.setId(jregion.getString("id"));
				ar.setName(jregion.getString("name"));
				article.setRegion(ar);
				articles.add(article);
			}

			Object[] data = { articles };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 解析文章详情
	 * 
	 * @param jsonString
	 * @throws JSONException
	 */
	public static NetResult parseArticleDetail(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			ArrayList<Comment> commentList = new ArrayList<Comment>();
			JSONObject jsonData = jso.getJSONObject("data");
			String commentCount = jsonData.getString("commentCount");
			JSONArray jsa = jsonData.getJSONArray("hotComments");
			for (int i = 0, isize = jsa.length(); i < isize; i++) {
				Comment coment = new Comment();
				coment.setHot(true);
				JSONObject tempJso = jsa.getJSONObject(i);
				coment.setContent(getStringFroJso("content", tempJso));
				coment.setTime(getStringFroJso("created", tempJso));
				coment.setId(getStringFroJso("id", tempJso));
				coment.setParentId(getStringFroJso("parentId", tempJso));
				coment.setPraise(getStringFroJso("praise", tempJso));
				coment.setRelationId(getStringFroJso("relationId", tempJso));

				JSONArray subAry = tempJso.getJSONArray("subComment");
				if (null != subAry && subAry.length() > 0) {
					for (int x = 0, xsize = subAry.length(); x < xsize; x++) {
						JSONObject subJso = subAry.getJSONObject(x);
						Comment subComent = new Comment();
						subComent.setContent(getStringFroJso("content", subJso));
						subComent.setTime(getStringFroJso("created", subJso));
						subComent.setId(getStringFroJso("id", subJso));
						subComent.setParentId(getStringFroJso("parentId", subJso));
						subComent.setPraise(getStringFroJso("praise", subJso));
						subComent.setRelationId(getStringFroJso("relationId", subJso));
						subComent.setType(getStringFroJso("type", subJso));
						subComent.setUid(getStringFroJso("uid", subJso));
						try {
							subComent.setUser(parserUser(subJso.getJSONObject("user")));
						} catch (Exception e) {
							LogUtil.e(App.tag, "评论用户解析失败！");
						}
						coment.addSubComment(subComent);
					}
				}
				coment.setType(getStringFroJso("type", tempJso));
				coment.setUid(getStringFroJso("uid", tempJso));
				try {
					coment.setUser(parserUser(tempJso.getJSONObject("user")));
				} catch (Exception e) {
					e.printStackTrace();
				}
				commentList.add(coment);
			}
			Object[] data = { commentCount, commentList, };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 解析消息
	 * 
	 * @param jsonString
	 * @throws JSONException
	 */
	public static NetResult parseMessage(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONArray jsary = jso.getJSONArray(body);
			ArrayList<Message> messageList = new ArrayList<Message>();
			for (int i = 0, isize = jsary.length(); i < isize; i++) {
				JSONObject jsMessage = jsary.getJSONObject(i);
				Message msg = new Message();
				msg.setContent(getStringFroJso("content", jsMessage));
				msg.setId(getStringFroJso("id", jsMessage));
				msg.setTitle(getStringFroJso("title", jsMessage));
				msg.setUid(getStringFroJso("uid", jsMessage));
				msg.setCrateTime(getStringFroJso("created", jsMessage));
				messageList.add(msg);
			}
			Object[] data = { messageList };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 添加一级评论
	 * 
	 * @param jsonString
	 * @return
	 * @throws JSONException
	 */
	public static NetResult parseArticleComment1(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONObject jobj = jso.getJSONObject("body");
			Comment coment = new Comment();
			coment.setContent(getStringFroJso("content", jobj));
			coment.setId(getStringFroJso("id", jobj));
			coment.setTime(getStringFroJso("created", jobj));
			coment.setParentId(getStringFroJso("parentId", jobj));
			coment.setPraise(getStringFroJso("praise", jobj));
			coment.setRelationId(getStringFroJso("relationId", jobj));
			coment.setType(getStringFroJso("type", jobj));
			coment.setUid(getStringFroJso("uid", jobj));
			Object[] data = { coment };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 解析文章收藏
	 * 
	 * @param jsonString
	 * @throws JSONException
	 */
	public static NetResult parseCollectArticle(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	// 解析收藏商品
	public static NetResult parseCollectWare(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			ArrayList<CollectGoods> collectGods = new ArrayList<CollectGoods>();
			JSONArray jsary = jso.getJSONArray(body);
			for (int i = 0, isize = jsary.length(); i < isize; i++) {
				JSONObject jsoBj = jsary.getJSONObject(i);
				CollectGoods gods = new CollectGoods();
				gods.setSelfId(getStringFroJso("id", jsoBj));
				gods.setRelationId(getStringFroJso("relationId", jsoBj));
				gods.setUid(getStringFroJso("uid", jsoBj));
				// ===============
				JSONObject jobj = jsoBj.getJSONObject("ware");
				gods.setAfterScale(getStringFroJso("afterSale", jobj));
				JSONObject jbrand = jobj.getJSONObject("brand");
				BrandRegion brand = new BrandRegion(true);
				brand.setId(getStringFroJso("id", jbrand));
				brand.setName(getStringFroJso("name", jbrand));
				brand.setSequence(getStringFroJso("sequence", jbrand));
				gods.setBrand(brand);
				// =====
				gods.setBrandId(getStringFroJso("brandId", jobj));

				JSONObject jtypeJson = jobj.getJSONObject("parCategory");
				GoodsType godType = new GoodsType(false);
				godType.setIconDefaultUrl(NetInterface.warpImgUrl(getStringFroJso("iconDefault", jtypeJson)));
				godType.setIconSelectUrl(NetInterface.warpImgUrl(getStringFroJso("iconSelected", jtypeJson)));
				godType.setId(getStringFroJso("id", jtypeJson));
				godType.setName(getStringFroJso("name", jtypeJson));
				godType.setParentId(getStringFroJso("parentId", jtypeJson));
				godType.setSequence(getStringFroJso("sequence", jtypeJson));
				gods.setType(godType);// 商品类型
				// ====
				gods.setCostPrice(getStringFroJso("costPrice", jobj));
				gods.setSalePrice(getStringFroJso("salePrice", jobj));
				gods.setMarketPrice(getStringFroJso("marketPrice", jobj));
				gods.setSales(getStringFroJso("sales", jobj));
				gods.setDetailIntro(getStringFroJso("detailIntro", jobj));
				gods.setFavoriteCount(getStringFroJso("favoriteCount", jobj));
				gods.setId(getStringFroJso("id", jobj));
				gods.setPromotion(jobj.getBoolean("promotion"));
				// ====
				BrandRegion bregion = new BrandRegion(false);
				JSONObject regonObj = jobj.getJSONObject("region");
				bregion.setId(getStringFroJso("id", regonObj));
				bregion.setName(getStringFroJso("name", regonObj));
				bregion.setSequence(getStringFroJso("sequence", regonObj));
				gods.setRegion(bregion);
				gods.setRegionId(getStringFroJso("regionId", jobj));
				// =======
				gods.setSlogan(getStringFroJso("slogan", jobj));
				gods.setSpecification(getStringFroJso("specification", jobj));
				gods.setStatus(getStringFroJso("status", jobj));
				// =====
				JSONObject subTypeJson = jobj.getJSONObject("subCategory");
				GoodsType subType = new GoodsType(false);
				subType.setIconDefaultUrl(NetInterface.warpImgUrl(getStringFroJso("iconDefault", subTypeJson)));
				subType.setIconSelectUrl(NetInterface.warpImgUrl(getStringFroJso("iconSelected", subTypeJson)));
				subType.setId(getStringFroJso("id", subTypeJson));
				subType.setName(getStringFroJso("name", subTypeJson));
				subType.setParentId(getStringFroJso("parentId", subTypeJson));
				subType.setSequence(getStringFroJso("sequence", subTypeJson));
				gods.setSubType(subType);
				// ======
				gods.setSubTitle(getStringFroJso("subTitle", jobj));
				gods.setThumbnailImg(NetInterface.warpImgUrl(getStringFroJso("thumbnailImg", jobj)));
				gods.setTitle(getStringFroJso("title", jobj));
				gods.setUnit(getStringFroJso("unit", jobj));
				gods.setUpTime(getStringFroJso("upTime", jobj));
				collectGods.add(gods);
			}
			Object[] data = { collectGods };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 获取所有评论
	 * 
	 * @param jsonString
	 * @throws JSONException
	 */
	public static NetResult parseAllComment(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			ArrayList<Comment> commentList = new ArrayList<Comment>();
			JSONArray jsa = jso.getJSONArray("body");
			for (int i = 0, isize = jsa.length(); i < isize; i++) {
				Comment coment = new Comment();

				JSONObject tempJso = jsa.getJSONObject(i);
				coment.setContent(getStringFroJso("content", tempJso));
				coment.setTime(getStringFroJso("created", tempJso));
				coment.setId(getStringFroJso("id", tempJso));
				coment.setParentId(getStringFroJso("parentId", tempJso));
				coment.setPraise(getStringFroJso("praise", tempJso));
				coment.setRelationId(getStringFroJso("relationId", tempJso));

				JSONArray subAry = tempJso.getJSONArray("subComment");
				if (null != subAry && subAry.length() > 0) {
					for (int x = 0, xsize = subAry.length(); x < xsize; x++) {
						JSONObject subJso = subAry.getJSONObject(x);
						Comment subComent = new Comment();
						subComent.setContent(getStringFroJso("content", subJso));
						subComent.setTime(getStringFroJso("created", subJso));
						subComent.setId(getStringFroJso("id", subJso));
						subComent.setParentId(getStringFroJso("parentId", subJso));
						subComent.setPraise(getStringFroJso("praise", subJso));
						subComent.setRelationId(getStringFroJso("relationId", subJso));
						subComent.setType(getStringFroJso("type", subJso));
						subComent.setUid(getStringFroJso("uid", subJso));
						try {
							subComent.setUser(parserUser(subJso.getJSONObject("user")));
						} catch (Exception e) {
							LogUtil.e(App.tag, "评论用户解析失败！");
						}
						coment.addSubComment(subComent);
					}
				}
				coment.setType(getStringFroJso("type", tempJso));
				coment.setUid(getStringFroJso("uid", tempJso));
				try {
					coment.setUser(parserUser(tempJso.getJSONObject("user")));
				} catch (Exception e) {
					e.printStackTrace();
				}
				commentList.add(coment);
			}
			Object[] data = { commentList, };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}

	}

	/**
	 * 赞一个
	 * 
	 * @param jsonString
	 * @throws JSONException
	 */
	public static NetResult parsePraise(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 解析话题
	 * 
	 * @param jsonString
	 * @throws JSONException
	 */
	public static NetResult parseTopics(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONArray jsary = jso.getJSONArray(body);
			ArrayList<Topic> listTopics = new ArrayList<Topic>();
			Topic topTopic = null;
			for (int i = 0, isize = jsary.length(); i < isize; i++) {
				JSONObject jobj = jsary.getJSONObject(i);
				Topic topic = new Topic();
				topic.setAuthor(getStringFroJso("author", jobj));
				topic.setConmentCount(getStringFroJso("conmentCount", jobj));
				topic.setContent(getStringFroJso("content", jobj));
				topic.setCoverImg(getStringFroJso("coverImg", jobj));
				topic.setId(getStringFroJso("id", jobj));
				topic.setLead(getStringFroJso("lead", jobj));
				topic.setOrigin(getStringFroJso("origin", jobj));
				topic.setOriginalLink(getStringFroJso("originalLink", jobj));
				topic.setPeriod(getStringFroJso("period", jobj));
				topic.setPublishTime(getStringFroJso("publishTime", jobj));
				topic.setTitle(getStringFroJso("title", jobj));
				topic.setTop(Boolean.valueOf(getStringFroJso("isTop", jobj)));
				if (topic.isTop()) {
					topTopic = topic;
				}
				listTopics.add(topic);
			}
			Object data[] = { listTopics, topTopic };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	// 解析收藏的话题
	public static NetResult parseCollectTopics(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONArray jsary = jso.getJSONArray(body);
			ArrayList<CollectTopic> listTopics = new ArrayList<CollectTopic>();
			for (int i = 0, isize = jsary.length(); i < isize; i++) {
				JSONObject jobj = jsary.getJSONObject(i);
				CollectTopic topic = new CollectTopic();
				topic.setSelfId(getStringFroJso("id", jobj));
				topic.setType(getStringFroJso("type", jobj));
				topic.setUid(getStringFroJso("uid", jobj));
				// ======
				JSONObject topicContent = jobj.getJSONObject("topic");

				topic.setAuthor(getStringFroJso("author", topicContent));
				topic.setConmentCount(getStringFroJso("conmentCount", topicContent));
				topic.setContent(getStringFroJso("content", topicContent));
				topic.setCoverImg(getStringFroJso("coverImg", topicContent));
				topic.setId(getStringFroJso("id", topicContent));
				topic.setLead(getStringFroJso("lead", topicContent));
				topic.setOrigin(getStringFroJso("origin", topicContent));
				topic.setOriginalLink(getStringFroJso("originalLink", topicContent));
				topic.setPeriod(getStringFroJso("period", topicContent));
				topic.setPublishTime(getStringFroJso("publishTime", topicContent));
				topic.setTitle(getStringFroJso("title", topicContent));
				topic.setTop(Boolean.valueOf(getStringFroJso("isTop", topicContent)));
				listTopics.add(topic);
			}
			Object data[] = { listTopics };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 解析话题详情
	 * 
	 * @param jsonString
	 * @throws JSONException
	 */
	public static NetResult parseDetailTopic(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONObject jobj = jso.getJSONObject(body);
			Topic topic = new Topic();
			topic.setAuthor(getStringFroJso("author", jobj));
			topic.setConmentCount(getStringFroJso("conmentCount", jobj));
			topic.setContent(getStringFroJso("content", jobj));
			topic.setCoverImg(getStringFroJso("coverImg", jobj));
			topic.setId(getStringFroJso("id", jobj));
			topic.setLead(getStringFroJso("lead", jobj));
			topic.setOrigin(getStringFroJso("origin", jobj));
			topic.setOriginalLink(getStringFroJso("originalLink", jobj));
			topic.setPeriod(getStringFroJso("period", jobj));
			topic.setPublishTime(getStringFroJso("publishTime", jobj));
			topic.setTitle(getStringFroJso("title", jobj));

			TopicSelected topcSelect = null;
			try {
				JSONObject voteTopic = jobj.getJSONObject("topicSelected");
				topcSelect = new TopicSelected();
				topcSelect.setContent(voteTopic.getString("content"));
				topcSelect.setCountingDays(voteTopic.getString("countingDays"));
				topcSelect.setId(voteTopic.getString("id"));
				topcSelect.setMultipleChoice(voteTopic.getBoolean("multipleChoice"));
				topcSelect.setPublicVoter(voteTopic.getBoolean("publicVoter"));
				topcSelect.setTopicId(voteTopic.getString("topicId"));
				// ====
				JSONArray topicOptions = voteTopic.getJSONArray("topicOptions");
				ArrayList<TopicOption> optionsList = new ArrayList<TopicOption>();
				for (int i = 0, isize = topicOptions.length(); i < isize; i++) {
					JSONObject optionObj = topicOptions.getJSONObject(i);
					TopicOption topicOption = new TopicOption();
					topicOption.setContent(optionObj.getString("content"));
					topicOption.setId(optionObj.getString("id"));
					topicOption.setTopicId(optionObj.getString("topicId"));
					topicOption.setTopicSelectedId(optionObj.getString("topicSelectedId"));
					topicOption.setVoteCount(optionObj.getInt("voteCount"));
					optionsList.add(topicOption);
					topcSelect.setTopicOptions(optionsList);
					// ===测试
				}
			} catch (Exception e) {
				e.printStackTrace();
			}

			// =======
			JSONObject jobj2 = jso.getJSONObject("data");
			String voteCount = getStringFroJso("voteCount", jobj2);
			Object data[] = { topic, voteCount, topcSelect };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 解析子评论结果
	 * 
	 * @param jsonString
	 * @throws JSONException
	 */
	public static NetResult parseSubComment(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONObject jobj = jso.getJSONObject("body");
			Comment coment = new Comment();
			coment.setContent(getStringFroJso("content", jobj));
			coment.setId(getStringFroJso("id", jobj));
			coment.setTime(getStringFroJso("created", jobj));
			coment.setParentId(getStringFroJso("parentId", jobj));
			coment.setPraise(getStringFroJso("praise", jobj));
			coment.setRelationId(getStringFroJso("relationId", jobj));
			coment.setType(getStringFroJso("type", jobj));
			coment.setUid(getStringFroJso("uid", jobj));
			Object[] data = { coment };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 添加一级评论
	 * 
	 * @param jsonString
	 * @return
	 * @throws JSONException
	 */
	public static NetResult parseTopicComment(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			JSONObject jobj = jso.getJSONObject("body");
			Comment coment = new Comment();
			coment.setContent(getStringFroJso("content", jobj));
			coment.setId(getStringFroJso("id", jobj));
			coment.setTime(getStringFroJso("created", jobj));
			coment.setParentId(getStringFroJso("parentId", jobj));
			coment.setPraise(getStringFroJso("praise", jobj));
			coment.setRelationId(getStringFroJso("relationId", jobj));
			coment.setType(getStringFroJso("type", jobj));
			coment.setUid(getStringFroJso("uid", jobj));
			Object[] data = { coment };
			netresult.setData(data);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 解析投票结果
	 * 
	 * @param jsonString
	 * @return
	 * @throws JSONException
	 */
	public static NetResult parseTopicVote(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	public static NetResult parseAddTopic(String jsonString) throws JSONException {
		if (StringUtils.isEmpty(jsonString)) {
			return null;
		}
		NetResult netresult = new NetResult();
		JSONObject jso = new JSONObject(jsonString);
		String isSucess = jso.getString(success);
		if (true == Boolean.parseBoolean(isSucess)) {
			netresult.setSuccess(true);
			return netresult;
		} else {
			netresult.setSuccess(false);
			netresult.setMessage(jso.getString(message));
			return netresult;
		}
	}

	/**
	 * 解析用户
	 * 
	 * @param jobj
	 * @return
	 */
	private static User parserUser(JSONObject jobj) {
		try {
			User u = new User();
			u.setAddress(getStringFroJso("address", jobj));
			u.setHeadPortrait(getStringFroJso("headPortrait", jobj));
			u.setUid(getStringFroJso("id", jobj));
			u.setMobilePhone(getStringFroJso("mobilePhone", jobj));
			u.setName(getStringFroJso("name", jobj));
			u.setNikename(getStringFroJso("nikename", jobj));
			u.setPassword(getStringFroJso("password", jobj));
			u.setPostCode(getStringFroJso("postCode", jobj));
			u.setQq(getStringFroJso("qq", jobj));
			u.setSex(getStringFroJso("sex", jobj));
			u.setType(getStringFroJso("type", jobj));
			u.setUsername(getStringFroJso("username", jobj));
			return u;
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return null;
	}

	// ==================
	public static String getStringFroJso(String key, JSONObject jobj) throws JSONException {
		if (jobj.has(key)) {
			return jobj.getString(key);
		} else {
			return "";
		}

	}
}
